var Lexer = require('./Lexer.js');//词法解析器
var CompilerParser = require('./CompilerParser.js');//语法解析器


/*var code=`let x=y+5;
y=2;`;*/

/*var code=`let x=123;
let y=1234;
let u=12345;

`;*/

/*var code=`let x=123;
let x = y;
`;*/

/*var code=`let x = y;
return 123456;
`;*/

/*var code=`foo;
123456;
`;*/

/*//前序表达式
var code=`!foo;
-123456;
-123457;
`;*/

/*//中序表达式
var code=`4+5*6;
`;*/

/*var code=`true;
false;
`;*/


var code=`3*(5+2);
`;

/*var code=`if(x>y){
	let z=x+y;
	return z;
}else{
	let u=x-y;
	return u;
}
`;*/


/*var code=`fn(x,y){
	let z=x+y;
	return z;
}(1,(2+3*4));
`;*/

var le=new Lexer(code);
console.log(le);
// le.lexing();
var parser=new CompilerParser(le);
parser.parseProgram();
for (var i = 0; i < parser.program.statements.length; i++) {
	console.log(parser.program.statements[i].getLiteral())
}


